/*

Author   : chaos

FileName : ptr_arr.cpp

Date     : 08/08/17 14:21:47

*/
#include <iostream>
using namespace std;

int main(void)
{
    int array[4] = {0,1,2,3} , *ptr;
    ptr = array ;

    cout << "element \t\t| array + i\t| *(array+i)" << endl;
    cout << "--------------------------------------------" << endl;

    for(int i=0; i<4; i++ )
        cout <<"array["<< i << "]\t|" << array +i << "\t|" << *(array+i) << endl;


    cout << endl << "array:" <<array << endl << endl;

    cout <<"element\t\t| ptr\t\t| *ptr" << endl;
    cout << "--------------------------------------" << endl;

    for (int i = 0; i < 4; i++) {
        cout <<"array[" <<i <<"]\t|" << ptr <<"\t|" << *ptr << endl;
        ptr ++;

    }
    cout << endl << "ptr:" << ptr << endl;
    return 0;
}
